<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/assets/cashier/css/main.css"/>
    <link rel="stylesheet" href="/assets/cashier/css/iconfont.css">
    <link rel="stylesheet" href="/assets/cashier/css/print.css">	
    <script type="text/javascript" src="/assets/cashier/js/jquery-1.11.3.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/jquery-migrate-1.2.1.min.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/main.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/OrderPushServer.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/jquery.i18n.properties.min.js"></script>
    <title >首页</title>
    <style>
    	.shop-list-name{
    		height: 50px;
    		overflow: hidden;
    	}
    	.pass-input-box{
    		width: 100%;
    		padding: 0 30px;
    	}
    	.odd-input-box{
    		width: 100%;
    		padding: 0 30px;
    	}
    	.pass-input,.odd-input,.actual-input{
    		width:135px;
		    height: 26px;
		    line-height:26px;
		    padding: 0 10px;
		    border: 1px solid #d1d1d1;
		    border-radius: 5px;
		    color: #666;
		    font-size: 14px;
    	}
    	.index-lable{
    		color: #666;
    		font-size: 14px;
    		margin-right: 10px;
    	}
    </style>
</head>
<body>
    <div class="container">
        <div class="nav">
            <div class="user-head">
                <img src="/assets/logo.png"/>
            </div>
            <div class="nav-con">
                <ul>
                    <li class="nav-list active">
                        <a href="/cashier/index/index/index">
                            <span class="iconfont icon-shouyin"></span>
                            <p data-locale="msg_shouyin">收银台</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/order">
                            <span class="iconfont icon-guadan"></span>
                            <p data-locale="msg_guadan">挂单</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/members">
	                        <span class="iconfont icon-huiyuan"></span>
	                        <p data-locale="msg_huiyuan">会员</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/count">
                            <span class="iconfont icon-tongji"></span>
                            <p data-locale="msg_tongji">统计</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/change">
                            <span class="iconfont icon-tuihuo"></span>
                            <p data-locale="msg_tuihuanhuo">退换货</p>
                        </a>
                    </li>
                </ul>
            </div>
            <div class="nav-foot">
                <div class="nav-foot-list nav-lock">
                    <span class="iconfont icon-suo"></span>
                    <p data-locale="msg_suoding">锁定</p>
                </div>
                <div class="nav-foot-list nav-cancel">
                    <a href="/cashier/index/index/exchange">
                        <span class="iconfont icon-tuichu"></span>
                        <p data-locale="msg_jiaoban">交班</p>
                    </a>
                </div>
            </div>
        </div>
        <div class="content">
            <div class="custom pull-left">
                <div class="custom-head">
                    <div class="vip hide">
                        <div class="switch-vip" data-locale="msg_switchUser">切换为普通用户</div>
                        <div class="custom-head-img">
                             <img src="/assets/avatar.png"/>
                        </div>
                        <div class="custom-head-con">
                            <div class="customer"></div>
                            <div class="custom-head-card">
                                <span><span data-locale="msg_yue">余额</span><span class="balance"></span></span>
                                <span class="custom-head-discount"><span data-locale="msg_zhekou">折扣</span>：<span class="discount"></span></span>
                            </div>
                        </div>
                    </div>
                    <div class="ordinary">
                        <div class="custom-head-img">
                             <img src="/assets/avatar.png"/>
                        </div>
                        <div class="custom-head-con">
                            <div class="customer" data-locale="msg_putong">普通用户</div>
                            <div class="custom-head-card" data-locale="msg_changeVip">
                                点击此处更换会员
                            </div>
                        </div>
                    </div>
                    <div class="vip-phone hide">
                        <input type="text" class="vip-input" name="phone" placeholder="请输入手机号">
                        <span class="btn-small vip-submit" data-locale="msg_queren">确定</span>
                        <span class="btn-small vip-cancel" style="background: #feccb3;color: #f47b40;margin-left: 10px" data-locale="msg_quxiao">取消</span>
                    </div>
                </div>
                <div class="custom-body">
                    <div class="custom-menu">
                        <ul></ul>
                    </div>
                    <div class="custom-total">
                        <div class="custom-total-num">
                            <span><span data-locale="msg_num">数量</span>：<span class="totalNum">0</span></span>
                            <span><span data-locale="msg_total">合计</span>：￡<span class="totalPrice">0</span></span>
                            <span><span data-locale="msg_youhui">优惠</span>：￡<span class="discountPrice">0</span></span>
                        </div>
                        <div class="custom-total-price">
                            <span class="pull-right"><span data-locale="msg_yingfu">应付</span>：￡<span class="deal">0</span></span>
                        </div>
                    </div>
                    <div class="custom-operate">
                        <div class="custom-operate-list">
                            <div class="btn btn-default custom-clear" data-locale="msg_clear">清空</div>
                            <div class="btn btn-primary custom-guadan" data-locale="msg_guadan">挂单</div>
                            <div class="btn btn-primary custom-note" data-locale="msg_remark">备注</div>
                            <div class="btn btn-primary custom-discount" data-locale="msg_youhui">优惠</div>
                        </div>
                        <div class="custom-operate-account btn" style="height: 40px;line-height: 40px;border-radius: 20px" data-locale="msg_jiesuan">结算</div>
                    </div>
                </div>
            </div>
            <div class="shop pull-left">
                <div class="shop-head">
                    <div class="shop-head-search">
                        <span class="iconfont icon-search"></span>
                        <input type="text" name="keyword" class="search-input" placeholder="请扫描商品条形码或输入商品名称搜索商品">
                    </div>
                    <div class="shop-head-btn btn-active pull-right" data-locale="msg_search">搜索</div>
                </div>
                <div class="shop-content">
                    <div class="shop-content-left pull-left">
                        <div class="shop-lists ">
                        	<ul></ul>
                    	</div>
                        <div class="shop-pages"></div>
                    </div>
                    <div class="shop-nav pull-left">
                        <ul> </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="popbg">
        <!--清空-->
        <div class="popbox" id="clear">
            <div class="pop-body">
                <div class="wenhao">?</div>
                <div class="account-tip" data-locale="msg_qdqk">你确认要清空此订单吗？</div>
            </div>
            <div class="pop-foot">
                <div class="leftButton pull-left" data-locale="msg_quxiao">取消</div>
                <div class="rightButton pull-left clear-btn" data-locale="msg_queren" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <div class="popbox" id="discount">
            <div class="pop-head" data-locale="msg_sryhje">请输入优惠金额</div>
            <div class="pop-body">
                <div class="pop-input-box">
                    ￡<input type="text" name="discount" class="discount-input">
                </div>
                <div class="pop-total">
                    <span style="margin-right: 30px"><span data-locale="msg_ddzje">订单总金额</span>：￡<span class="order-no-total"></span></span>
                    <span data-locale="msg_yhhje">优惠后金额</span>：<span class="money">￡<span class="order-discount-total"></span></span>
                </div>
            </div>
            <div class="pop-foot">
                <div class="leftButton pull-left" data-locale="msg_quxiao">取消</div>
                <div class="rightButton pull-left discount-btn" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <!--备注-->
        <div class="popbox" id="note">
            <div class="pop-body">
                <input type="text" name="note" class="note-input" placeholder="请填写备注信息">
            </div>
            <div class="pop-foot">
                <div class="leftButton pull-left" data-locale="msg_quxiao">取消</div>
                <div class="rightButton pull-left note-btn" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <!--支付方式-->
        <div class="popbox" id="payStyle" style="padding: 0;height: 350px;">
            <div class="pop-top">
                <div class="pop-cell">
                    <p class="payMoney">￡<span class="fee"></span></p>
                    <p data-locale="msg_yfje">应付金额</p>
                </div>
                <div class="pop-cell">
                    <p class="payMoney">￡<span class="vipPay"></span></p>
                    <p data-locale="msg_Balance">会员卡支付</p>
                </div>
                <div class="pop-cell" style="border: none">
                    <p class="payMoney">￡<span class="otherPay"></span></p>
                    <p data-locale="msg_hxpay">还需支付</p>
                </div>
            </div>
            <div class="pop-center" style="padding-bottom: 0;">
                <ul>
                   
                </ul>
            </div>
            <div class="odd-input-box hide">
            	<div class="actual-box"style="margin-bottom: 10px;display: inline-block;">
            		<label class="index-lable">实付金额:</label>
            		<input type="actual" name="actual" class="actual-input" placeholder="请输入实付金额"/>
            	</div>
            	<div class="odd-box" style="display: inline-block;">
            		<label class="index-lable">找零金额:</label>
            		<input type="odd" name="odd" class="odd-input"/> 
            	</div>
            </div>
            <div class="pass-input-box hide"><input type="password" name="pass" class="pass-input" placeholder="请输入支付密码"/></div>
            <div class="pop-foot">
                <div class="leftButton pull-left pay-cancel" data-locale="msg_quxiao">取消</div>
                <div class="rightButton pull-left pay-btn" data-locale="msg_qrpay">确认支付</div>
            </div>
        </div>
        <!--结算-->
        <div class="popbox" id="account">
            <div class="pop-body">
                <div class="wenhao">?</div>
                <div class="account-tip" data-locale="msg_qdjs">你确认要结算此订单吗？</div>
            </div>
            <div class="pop-foot">
                <div class="leftButton pull-left" data-locale="msg_quxiao">取消</div>
                <div class="rightButton pull-left account-btn" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <!--挂单-->
        <div class="popbox" id="guadan">
            <div class="pop-body">
                <div class="wenhao">?</div>
                <div class="account-tip" data-locale="msg_qdgd">你确认要挂单吗？</div>
            </div>
            <div class="pop-foot">
                <div class="leftButton pull-left" data-locale="msg_quxiao">取消</div>
                <div class="rightButton pull-left guadan-btn" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <!--锁定-->
        <div class="popbox" id="lock">
            <div class="pop-head" data-locale="msg_qxsd">请填写你的密码取消锁定</div>
            <div class="pop-body">
                <input class="lock-input" name="password">
            </div>
            <div class="pop-foot">
                <div class="centerButton lock-btn" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <!--打印-->
        <div id="printer" class="print-order">
        	<div class="code"><img src="../../../assets/logo.png"/></div>
			<div class="title">日出行中国超市</div>
			<div class="en-title">Sunrise Chinese Market Ltd</div>
			<div class="address">
				<p>84 Colman Road, Norwich, NR4 7EH</p>		
				<p>01603 927952	</p>	
			</div>
			<div class="offline">
				<div class="line-type"><span class="pull-left">OFFLINE</span><span class="pull-right">顾客线下消费小票</span></div>
				<div class="print-list">收银员工：<span class="cashier-name"></span></div>
				<div class="print-list">消费时间：<span class="order-time"></span></div>
				<div class="print-list">线下订单：<span class="order_id"></span></div>
			</div>
			<div class="online hide">
				<div class="line-type"><span class="pull-left">ON-LINE</span><span class="pull-right">顾客线上消费送货小票</span></div>
				<div class="print-list">送货时间：<span class="delivery-time"></span></div>
				<div class="print-list">收银员工：<span class="cashier-name"></span></div>
				<div class="print-list">消费时间：<span class="order-time"></span></div>
				<div class="print-list">线上订单：<span class="order_id"></span></div>
			</div>
			<div class="print-list vip-name-box">会员姓名：<span class="vip-name"></span></div>
			<div class="print-list">微信号码：<span class="vip-weixin"></span></div>
			<div class="print-list">送货地址：<span class="vip-address"></span></div>
			<div class="print-list">送货邮编：<span class="vip-site"></span></div>
			<div class="print-list">联系电话：<span class="vip-phone"></span></div>
			<div class="print-list">备注：<span class="vip-remark"></span></div>
			<div class="print-list">支付方式：<span class="print-order-payMode"></span></div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>单价(￡)</span>
				<span>数量</span>
				<span>金额(￡)</span>
			</div>
			<div class="line"></div>
			<div class="print-table-body"> </div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>共计</span>
				<span class="print-table-total-food"></span>
				<span class="print-table-total-price"></span>
			</div>
			<div class="line"></div>
			<div class="consumption"></div>
			
			<div class="line"></div>
			<div class="print-list text-center">VAT RECEIPT SUMMARY</div>
			<div class="print-list text-center">NET：<span class="vat-net"></span></div>
			<div class="print-list text-center">20%VAT：<span class="vat-20"></span></div>
			<div class="print-list text-center">GROSS：<span class="vat-gross"></span></div>
			<div class="print-list text-center">VAT No. : 157965263</div>
			<div class="line"></div>
			<div class="print-time">打印时间：<span class="print-time-detail"></span></div>
			<div class="print-time">感谢惠顾，期待您的再次光临</div>
			<div class="print-time">加入会员，更多折扣，更多优惠，更多方便</div>
			<div class="print-time">扫我↓</div>
			<div class="code"> <img src="../../../assets/cashier/img/richubao.jpg" /></div>
		</div>
		<div id="online" class="print-online">
        	<div class="code"><img src="../../../assets/logo.png"/></div>
			<div class="title">日出行中国超市</div>
			<div class="en-title">Sunrise Chinese Market Ltd</div>
			<div class="address">
				<p>84 Colman Road, Norwich, NR4 7EH</p>		
				<p>01603 927952	</p>	
			</div>
			
			<div class="line-type"><span class="pull-left">ON-LINE</span><span class="pull-right">顾客线上消费送货小票</span></div>
			<div class="print-list">送货时间：<span class="delivery-time"></span></div>
			<div class="print-list">收银员工：<span class="cashier-name"></span></div>
			<div class="print-list">消费时间：<span class="order-time"></span></div>
			<div class="print-list">线上订单：<span class="order_id"></span></div>
			
			<div class="print-list vip-name-box">会员姓名：<span class="vip-name"></span></div>
			<div class="print-list">微信号码：<span class="vip-weixin"></span></div>
			<div class="print-list">送货地址：<span class="vip-address"></span></div>
			<div class="print-list">送货邮编：<span class="vip-site"></span></div>
			<div class="print-list">联系电话：<span class="vip-phone"></span></div>
			<div class="print-list">备注：<span class="vip-remark"></span></div>
			<div class="print-list">支付方式：<span class="print-order-payMode"></span></div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>单价(￡)</span>
				<span>数量</span>
				<span>金额(￡)</span>
			</div>
			<div class="line"></div>
			<div class="print-table-body"> </div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>共计</span>
				<span class="print-table-total-food"></span>
				<span class="print-table-total-price"></span>
			</div>
			<div class="line"></div>
			<div class="consumption"></div>
			
			<div class="line"></div>
			<div class="print-list text-center">VAT RECEIPT SUMMARY</div>
			<div class="print-list text-center">NET：<span class="vat-net"></span></div>
			<div class="print-list text-center">20%VAT：<span class="vat-20"></span></div>
			<div class="print-list text-center">GROSS：<span class="vat-gross"></span></div>
			<div class="print-list text-center">VAT No. : 157965263</div>
			<div class="line"></div>
			<div class="print-time">打印时间：<span class="print-time-detail"></span></div>
			<div class="print-time">感谢惠顾，期待您的再次光临</div>
			<div class="print-time">加入会员，更多折扣，更多优惠，更多方便</div>
			<div class="print-time">扫我↓</div>
			<div class="code"> <img src="../../../assets/cashier/img/richubao.jpg" /></div>
		</div>
    </div>
    <div class="tip hide"></div>
    <script type="text/javascript">
        var goods_page=1,keyword='',cate_id='hot',total_page = 1;
       var remark='';
       var order_id,fee=0,balance=0;
       var oddChange=0;//实付
       var pays=[];
       var units=SITE_CONFIG.units;
       var categories=SITE_CONFIG.categories
       var pay_types=SITE_CONFIG.pay_types;
        $(function () {
            var I18N_LANG=SITE_LANG == 'chinese' ? 'zh_CN':'en_US';
            loadProperties();
            function loadProperties() {
                $.i18n.properties({
                    name:'lang',
                    path:'/assets/cashier/language/',
                    mode:'map',
                    language:I18N_LANG,
                    callback:function(){
                        $("[data-locale]").each(function(){	
                            $(this).html($.i18n.prop($(this).data("locale")));
                        });
                    }
                });
            }
			lock();
            //适应浏览器宽稿
            var windowHeight=$('.nav').height();
            var windowWidth=document.body.clientWidth;
            var shopWidth=windowWidth-570+"px";
            var listWidth = windowWidth-770+"px";
            $('.custom').css({height:windowHeight-10+'px'});
            $('.shop').css({width:shopWidth,height:windowHeight-10+'px'});
            $('.shop-content-left').css({width:listWidth,height:windowHeight-90+'px'});
            $('.shop-lists,.shop-nav').css({height:windowHeight-150+'px'});
            $('.custom-menu').css({height:windowHeight-330+'px'});

            $('.nav-list').on('click',function () {
                $(this).addClass('active').siblings().removeClass('active');
            });
            $('body').on('click','.shop-nav-list',function () {
                $(this).addClass('active').siblings().removeClass('active');
                var id=$(this).attr('data-id');
                goods_page = 1;
                keyword = '';
                cate_id = id;
                getShop();
            });
            $('.search-input')[0].focus();
            //输入框语言
            $('.vip-input').attr('placeholder',lang('INDEX_PHONE_PLACE'))
            $('.search-input').attr('placeholder',lang('INDEX_SEARCH_PLACE'))
            $('.note-input').attr('placeholder',lang('INDEX_NOTE_PLACE'))
            //商品类别
			var li='<li class="shop-nav-list active" data-id="hot">'+(SITE_LANG=='chinese' ? '热门':'hot')+'</li>'+'<li class="shop-nav-list" data-id="weight">'+(SITE_LANG=='chinese' ? '称重':'weight')+'</li>';
	        $.each(categories,function (index,item) {
	            li+='<li class="shop-nav-list" data-id="'+item.id+'">'+(SITE_LANG=='chinese' ? item.title:item.en_title)+'</li>'
	        });
	        $('.shop-nav ul').html(li);
            //会员切换
            var user_id='';
            $('.custom .custom-head-card').on('click',function () {
                $(this).parents('.ordinary').hide().siblings('.vip-phone').show();
                $('.vip-input')[0].focus();
            });
            $('.custom .vip-cancel').on('click',function () {
                $(this).parents('.vip-phone').hide().siblings('.ordinary').show();
            });
            // 查找用户
            var vipname='';
            var member={};
            function searchVip(){
                var phone=$('.vip-input').val()
                if(!phone){
                    tip(lang('INDEX_NO_PHONE'))
                    return;
                }
               
                var params={phone:phone};
                $.ajax({
                    type:'GET',
                    data:params,
                    dataType:'json',
                    url:urlHead+'/user/find_user',
                    success:function (json) {
                        console.log(json);
                        member=json;
                        member.phone=phone;
                        user_id=json.id;
                        var avatar=json.avatar ? json.avatar : "/assets/avatar.png"
                       	balance=json.balance;
                        discount=json.discount;
                        var name='';
                         if(json.first_name){
                         	name=json.first_name+' '+json.last_name;
                         }else{
                         	name=json.nickname;
                         }
                         vipname=name;
                         name+='('+json.phone+')';
                        $('.vip').show().siblings().hide();
                        $('.vip').find('img').attr('src',avatar);
                        $('.vip').find('.customer').html(name);
                        $('.vip').find('.balance').html(json.balance);
                        $('.vip').find('.discount').html(json.discount);
                        if(cart.length>0){
                        	discountPrice=((1-json.discount)*totalPrice).toFixed(2);
                        	deal=(totalPrice-discountPrice).toFixed(2);
                        	console.log(deal,discountPrice)
                        	$('.discountPrice').html(discountPrice);
                        	$('.deal').html(deal);
                        }
//                      isVip=true;
                    },
                    error:function(res){
                       if(res.responseJSON.error == 404){

                    	tip(lang('INDEX_NO_USER'));
                    	return;
                       }else if(res.responseJSON.error == 400){
                        	tip(lang('INDEX_DISABLED_USER'));
                        	return;
                        }
                    }
                })
            }
            //会员搜索
            $('.custom .vip-submit').on('click',function () {
                searchVip();  
            });
           $('.vip-input').keydown(function (event) {
                if(event.keyCode == 13){
                  searchVip()
                }
            })
            $('.custom .switch-vip').on('click',function () {
                $(this).parents('.vip').hide().siblings('.ordinary').show();
                user_id=0;
            });
            //弹窗,优惠
            $('.custom-discount').on('click',function () {
            	totalPrice=parseFloat($('.totalPrice').html());
	            discountPrice=parseFloat($('.discountPrice').html());
	            deal=$('.deal').html();
//	            console.log(discountPrice,totalPrice,deal)
	            if($('.custom-menu ul li').length<1){
                    tip(lang('INDEX_NO_SHOP'))	
	            }else{
	            	pop();
	                $('#discount').show().siblings().hide();
	                $('.discount-input')[0].focus();
	                
	                $('.discount-input').val(discountPrice);
	                $('.order-no-total').html(totalPrice);
	                $('.order-discount-total').html(deal);
	            }   
            });
            //两位有效数字
            //失去焦点
            $('.discount-input').focusout(function () {
            	 var val=$(this).val();
                if(isNaN(val)){
                	$(this).val(0);
                }else{
                	var b = parseFloat(val);
                	$(this).val(Number(b).toFixed(2));
                }
            	if($('.discount-input').val()>totalPrice){
            		$('.discount-input').val(discountPrice);
            		return;
            	}else{
            		discountPrice=$('.discount-input').val();
	                deal=(totalPrice- discountPrice).toFixed(2);
	                $('.order-discount-total').html(deal)
            	}
            });
            $('.discount-btn').click(function () {
            	discountPrice=$('.discount-input').val();
                deal=(totalPrice- discountPrice).toFixed(2);
                if(!discountPrice){
                    tip(lang('INDEX_NO_DISCOUNT'))
                    return;
                }
                
                $('.discountPrice').html(discountPrice);
                $('.deal').html(deal);
                $('.popbg').hide();
            })
            //清空
            $('.custom-clear').on('click',function () {
                pop();
                $('#clear').show().siblings().hide();
            });
            function clearCustom(){
            	discountPrice='';
            	remark='';
            	user_id =0;
                cart=[];
                pays=[];
                balance=0;
                fee=0;
                oddChange=0;
                vipname='';
                member={};
                $('.popbg').hide();
                $('.custom-menu ul li').remove();
                $('.totalPrice').html(0);
                $('.totalNum').html(0);
                $('.discountPrice').html(0);
                $('.deal').html(0);
               
                $('.ordinary').show().siblings().hide();
                $('.vip').find('.customer').html('');
                $('.vip').find('.balance').html('');
                $('.vip').find('.discount').html('');
                
                $('#payStyle .odd-input-box').hide();
                $('#payStyle .odd-input').val('');
                $('#payStyle .actual-input').val('');
                $('#payStyle .pass-input-box').hide();
                $('#payStyle .pass-input').val('');
                
            }
            $('.clear-btn').click(function(){
                clearCustom()	
            })
            //备注
            $('.custom-note').on('click',function () {
            	if($('.custom-menu ul li').length<1){
                    tip(lang('INDEX_NO_SHOP'))
               }else{
               		pop();
	                $('#note').show().siblings().hide();
	                $('.note-input')[0].focus();
               }
                
            })
            $('.note-btn').click(function () {
                    remark=$('.note-input').val();
                    if(!remark){
                        tip(lang('INDEX_NO_REMARK'))
                        return;
                    }
                    $('.popbg').hide();
                })
            //挂单
            $('.custom-guadan').on('click',function () {
            	if($('.custom-menu ul li').length<1){
                    tip(lang('INDEX_NO_SHOP'))
                }else{
                	pop();
                	$('#guadan').show().siblings().hide(); 
                }    
            });
            $('.guadan-btn').click(function () {
                var privilege=discountPrice;
                var items='';
                var numbers='';
                for(var i=0;i<cart.length;i++){
                    if(items) items += ',';
                    items += cart[i].id;
                    if(numbers) numbers += ',';
                    numbers += cart[i].num || cart[i].qty;
                }
                var data={
                    privilege:privilege,
                    remark:remark,
                    items:items,
                    numbers:numbers,
                    user_id:user_id ? user_id:''
                };
                console.log(data);
                  $.ajax({
                      type:'POST',
                      data:data,
                      dataType:'json',
                      url:urlHead+'/order/bill',
                      success:function (json) {
                          clearCustom();
                          tip(lang('INDEX_BILL_SUCCESS'))
                      },
                      fail:function (json) {
                          console.log(json)
                      }
                  })
                })
            //支付
            $('.custom-operate-account').on('click',function () {
            	if($('.custom-menu ul li').length<1){
                    tip(lang('INDEX_NO_SHOP'))
               }else{
               	 pop();
               	 $('#account').show().siblings().hide();
               	
               }
               
            });
            //支付弹窗
            $('.account-btn').click(function () {
            	var privilege=discountPrice;
                var items='';
                var numbers='';
                pays=[];
                for(var i=0;i<cart.length;i++){
                    if(items) items += ',';
                    items += cart[i].id;
                    if(numbers) numbers += ',';
                    numbers += cart[i].num || cart[i].qty;
                }
                var data={
                    privilege:privilege,
                    remark:remark,
                    items:items,
                    numbers:numbers,
                    user_id:user_id ? user_id:''
                };
                console.log(data);
                  $.ajax({
                      type:'POST',
                      data:data,
                      dataType:'json',
                      url:urlHead+'/order/create',
                      success:function (json) {

                      	order_id=json.order_id;
                      	fee=json.fee;
                        $('#payStyle').show().siblings().hide();
                        
                        var li='';
	                    $.each(pay_types,function (index,item) {
	                    	if(index ==3 || index ==7) return;
	                        li+='<li class="btn-middle btn-middle-primay" data-id="'+index+'">'+(SITE_LANG=='chinese'?item.chinese:item.english)+'</li>'
	                    });
	                    $('.pop-center ul').html(li);

	                    if(!user_id){
                        	$('.fee').html(fee);
                        	$('.vipPay').html(0);
                        	$('.otherPay').html(fee);
                        	$('.pop-center ul li').first().hide();
                        } else{
                        	if(balance > fee){
                        		$('.vipPay').html(fee);
                        		$('.otherPay').html(0);	
                        	}else{
                        		$('.vipPay').html(balance);
                        		$('.otherPay').html((fee-balance).toFixed(2));	
                        	}
                        	$('.fee').html(fee);
                        	$('.pop-center ul li').first().addClass('btn-middle-active').removeClass('btn-middle-primay');
                        	pays.push(0)
                        	$('#payStyle .pass-input-box').show()
                        }
                      },
                      error:function (json) {
                      	if(json.status == 422){
                      		tip(lang('INDEX_ORDER_FAIL'))
                      	}else if(json.status == 500){
                      		tip(lang('INDEX_ORDER_NUM'))
                      	}
                      }
                  })
            });
            //找零实现
            $('.actual-input').keyup(function(){
            	oddChange=$(this).val();
            	var odd=(oddChange-fee).toFixed(2);
            	$('.odd-input').val(odd);
            })
            //支付方式选择
            $('#payStyle').on('click','.btn-middle',function () {
            	var payId=$(this).attr('data-id');
            	if(!user_id){
					if($(this).hasClass('btn-middle-active')){
						pays.splice(0,1);
						$(this).addClass('btn-middle-primay').removeClass('btn-middle-active'); 
						if(payId == 1) $('#payStyle .odd-input-box').hide();
					}else{
						if(payId == 1){
							$('#payStyle .odd-input-box').show();	
						}else{
							$('#payStyle .odd-input-box').hide();
						} 
					  	$(this).addClass('btn-middle-active').removeClass('btn-middle-primay');
					  	$(this).siblings().addClass('btn-middle-primay').removeClass('btn-middle-active');
						if( pays.length>0){
	                        pays.splice(0,1);
	                    }
						pays.push(payId);
					}
                	console.log(pays);
            	}else{
            		
            		if(balance < fee){
            			if(payId != 0){
            				if($(this).hasClass('btn-middle-active')){
								pays.splice(1,1);
								$(this).addClass('btn-middle-primay').removeClass('btn-middle-active'); 
							}else{
							  $(this).addClass('btn-middle-active').removeClass('btn-middle-primay');
							  $(this).siblings().addClass('btn-middle-primay').removeClass('btn-middle-active');
							  if( pays.length>1){
		                         pays.splice(1,1);
		                       }
							  pays.push(payId);
							}	
            			};
            		}
            		console.log(pays);
            		$('#payStyle .pass-input-box').show();
            		$('.pop-center ul li').first().addClass('btn-middle-active').removeClass('btn-middle-primay');
            	}   
            });
            $('.pay-cancel').click(function(){
            	$('#payStyle .odd-input-box').hide();
                $('#payStyle .odd-input').val('');
                $('#payStyle .actual-input').val('');
                $('#payStyle .pass-input-box').hide();
                $('#payStyle .pass-input').val('');
            });
            $('.pay-btn').click(function(){
            	if(pays.length<1){
            		tip(lang('INDEX_SELECT_PAY'));
            		return;
            	}
            	
            	var pay_mode=pays.reverse().join();
            	var pay_fee;
            	var pay_pass;
            	if(!user_id){
            		pay_fee=fee;
            	}else{
            		pay_fee=$('.otherPay').html();
            		pay_pass=$('.pass-input').val();
            	}
            	
//          	for(var i=0;i<pays.length;i++){
//          		if(pays[i] == 1){
//          			if(oddChange<pay_fee){
//		            		tip('实付金额不小于应付金额');
//		            		return;
//		            	}
//          		}
//          	}
            	
            	var data={
            		order_id:order_id,
            		pay_mode:pay_mode,
            		pay_fee:pay_fee,
            		pay_pass:pay_pass
            	}
            	console.log(data);
            	$.ajax({
                      type:'POST',
                      data:data,
                      dataType:'json',
                      url:urlHead+'/order/pay',
                      success:function (json) {
                      	pop();
		                $('#printer').show().siblings().hide();
		                $('#printer .offline').show();
		                $('#printer .online').hide();
		                var payMode= '';
		                $.each(pays,function(index,item){
		                	payMode+=SITE_CONFIG.pay_types[item][SITE_LANG]
		                })
		                $('.print-order .order_id').html(json.id);
	            		$('.print-order .print-order-payMode').html(payMode+'支付');
	            		$('.print-order .cashier-name').html(CASHIER)
	            		$('.print-order .order-time').html(getTime())
	            		$('.print-order .print-time-detail').html(getTime())
	            		$('.print-order .vip-remark').html(remark)
		                var list='';
		                $.each(cart,function(index,item){
		                	list+='<div class="print-table-list">'
									+'<div class="print-food">'+(index+1)+'.'+item.p_title+'</div>'
									+'<div class="print-food-detail">'
									+	'<span>'+item.price+'</span>'
									+	'<span>'+item.num+'</span>'
									+	'<span>'+(item.num*item.price).toFixed(2)+'</span>'
									+'</div>'
								+'</div>'
		                })
		                $('.print-order .print-table-body').html(list);
	            		$('.print-order .print-table-total-food').html(totalNum);
	            		$('.print-order .print-table-total-price').html((totalPrice).toFixed(2));
	            		
	            		console.log(user_id,member)
	            		if(user_id>0){
	            			console.log(1)
            				$('.print-order .vip-name').html(vipname?vipname:member.nickname);
            				$('.print-order .vip-weixin').html(member.wechat);
            				$('.print-order .vip-address').html((member.address?member.address:''));
            				$('.print-order .vip-zip').html(member.zip);
            				$('.print-order .vip-phone').html(member.phone);
	            		}else{
	            			$('.print-order .vip-name-box').html('联系姓名：');
	            		}
            			var consumption='';
            			consumption+='<div class="print-list" >消费金额：'+(totalPrice).toFixed(2)+'</div>'
								+'<div class="print-list" >优惠金额：'+discountPrice+'</div>'
								
						if(pays.length>1){
							consumption+='<div class="print-list" >'+SITE_CONFIG.pay_types[pays[0]][SITE_LANG]+'支付：'+pay_fee+'</div>'
							+'<div class="print-list" >会员支付：'+balance+'</div>'
						}else{
							consumption+='<div class="print-list" >'+payMode+'支付：'+deal+'</div>'
						}
								
						if(user_id>0){	
							consumption+='<div class="print-list" >上次余额：'+balance+'</div>'
							consumption+='<div class="print-list" >当前余额：'+((balance-deal).toFixed(2) >0 ?(balance-deal).toFixed(2):0) +'</div>'
						}
            			$('.consumption').html(consumption);
            			var vatNet=Number(deal)-Number(json.vat)
            			$('.print-order .vat-net').html(vatNet.toFixed(2));
            			$('.print-order .vat-20').html(json.vat);
            			$('.print-order .vat-gross').html(deal);
		                $('#printer').jqprint();
                      	clearCustom();
                      	tip(lang('INDEX_ORDER_SUCCESS'))
                      },
                      error:function(res){
                      	if(res.error == 1){
                      		tip(lang('INDEX_ORDER_PAY'))
                      	}else if(res.error == 2){
                      		tip(lang('INDEX_ORDER_MONEY'))
                      	}else{
                      		tip(lang('INDEX_ORDER_NOT_FIND'))
                      	}
                      }
              	})	
            })
        
            //获取数据
            var shop=[];
            var cart=[];
            $('body').on('click','.page-next',function(){
                if (parseInt(goods_page)+1 <= total_page) {
                   goods_page++;
                   getShop();
                }
            });
            $('body').on('click','.page-prev',function(){
                if (parseInt(goods_page)-1 > 0) {
                    goods_page -= 1;
                    getShop();
                }
            });
            $('body').on('click','.page-target',function(){
                goods_page = parseInt($(this).html());
                getShop();
            });
            getShop();
            function getShop() {
               if(keyword) cate_id = 0;
               var params={page:goods_page,keyword:keyword,cate_id:cate_id};
                $.ajax({
                    type:'GET',
                    data:params,
                    dataType:'json',
                    url:urlHead+'//goods',
                    success:function (json) {
                        if(json.item){
                            json.current_page = 1;
                            json.last_page = 1;
                            json.page_size = 1;
                            json.data = [json.item];
                        }
                        var page=json.current_page;
                        var total=json.last_page;
                        total_page = json.last_page;
                        var page_size=json.page_size;
                        shop=json.data;
                      
                        var html='';
                        $.each(shop,function (index,item) {
                        	 var unit=''; 
                           for(var i in units){
                                if(item.unit == units[i].id){
                                	if(SITE_LANG=='chinese'){
                                		 unit='/'+units[i].title;   
                                	}else{
                                		 unit='/'+units[i].en_title;   
                                	}
                                   
                                }
                            }
                        	
                            html+='<li class="shop-list" product-id="'+item.product_id+'" data-id="'+item.id+'" data-index="'+index+'">'
                                +   '<div class="shop-list-img"><img src="'+item.thumbnail+'"/></div>'
                                +   '<div class="shop-list-con">'
                                +       '<div class="shop-list-name">'+(SITE_LANG=='chinese'?item.p_title:item.p_en_title)+'('+(SITE_LANG=='chinese'?item.title:item.en_title)+')'+'</div>'
                                +       '<div class="shop-list-price">￡'+item.price+unit+'</div>'
                                +   '</div>'
                                +'</li>'
                        });
                        $('.shop-lists ul').html(html);
                        if(parseInt(total)>1){
                            var pageHtml=paginate(total,page);
                            $('.shop-pages').html(pageHtml);
                        }else{
                        	 $('.shop-pages').html('');
                        }
                        $('.shop-lists ul').animate({scrollTop: '0px'}, 200)
                        //扫码获得的单个商品
                        if(shop.length == 1){
                        	addCart();
                        }

                    }
                })
            }
           	// 搜索
           	function search(){
           		keyword=$('.search-input').val();
                $('.search-input').val('').focus();
                goods_page = 1;
//              cate_id = ;
                getShop();
           	}
           	$('.search-input').keydown(function (event) {
                if(event.keyCode == 13){
                  search()
                }
            })
            $('.shop-head-btn').click(function () {
                search();
            });
            //购物车
            function addCart(ele){
            	totalPrice=parseFloat($('.totalPrice').html());
            	totalNum=$('.totalNum').html();
                var index=$(ele).attr('data-index') || 0;
                var id=$(ele).attr('data-id') || shop[0].id;
              
                if(cart.length>0){
                    for(var i=0;i<cart.length;i++){
                        if(id == cart[i].id){
                            //tip(lang('INDEX_HAD_ADD'))
                            $('.custom-menu-list[data-id='+id+'] .icon-add').trigger('click');
                            return;
                        }
                    }
                }
               
                var shopList=shop[index];
                shopList.num=1;
                cart.push(shopList);
                var price=parseFloat(shopList.price);

                totalNum++;
                totalPrice=parseFloat((price+totalPrice).toFixed(2));
                if(user_id>0){
                	 discountPrice=(totalPrice*(1-discount)).toFixed(2);
                	deal=(totalPrice-discountPrice).toFixed(2);
                }else{
                	discountPrice = 0;
                	deal = totalPrice;
                }
                
                $('.totalPrice').html(totalPrice);
                $('.totalNum').html(totalNum.toFixed(2));
                $('.discountPrice').html(discountPrice);
                $('.deal').html(deal);

				var unit='';
               for(var i in units){
                    if(shopList.unit == units[i].id){
                        if(SITE_LANG=='chinese'){
                    		 unit='/'+units[i].title;   
                    	}else{
                    		 unit='/'+units[i].en_title;   
                    	}
                    }
                }
                var html="";
                html+='<li class="custom-menu-list" data-id="'+shopList.id+'">'
                    +'<div class="custom-menu-list-name">'+(SITE_LANG=='chinese'?shopList.p_title:shopList.p_en_title)+'('+(SITE_LANG=='chinese'?shopList.title:shopList.en_title)+')'+'</div>'
                    +'<div style="height:25px">'
                    +    '<span class="money" style="line-height:25px">￡<span class="custom-menu-list-price">'+shopList.price+unit+'</span></span>'
                    +   '<div class="pull-right">'
                    +       '<span class="iconfont icon-jian"></span>'
                    +       '<input type="text" class="menu-list-num" value="1">'
                    +       '<span class="iconfont icon-add"></span>'
                    +   '</div>'
                    +'</div>'
                    +'</li>'
                $('.custom-menu ul').append(html);
                
                if($('.custom-menu').height() < $('.custom-menu ul').height()){
                	$('.custom-menu').animate({scrollTop: $('.custom-menu ul').height()}, 200)
                }
            }
            
            $('body').on('click','.shop-list',function () {
            	addCart(this);
            })
            
            var totalPrice=parseFloat($('.totalPrice').html());
            var totalNum=$('.totalNum').html();
            var discountPrice=parseFloat($('.discountPrice').html());
            var deal=$('.deal').html();
            var discount='';
//			console.log(totalPrice,totalNum,discountPrice,deal,discount)
            $('body').on('click','.custom-menu .icon-jian',function () {   	
                var num=$(this).siblings('.menu-list-num').val();
                var id=$(this).parents('.custom-menu-list').attr('data-id');
                var price=parseFloat($(this).parent().siblings().find('.custom-menu-list-price').html());
                if(num<=1){
                	totalPrice=parseFloat((totalPrice-price*num).toFixed(2));
                	totalNum-=num;
                	num = 0;
                	
                    for(var i in cart){
                        if(cart[i].id == id){
                            cart.splice(i,1);
                        }
                    }
                    $(this).parents('.custom-menu-list').remove();
                }else{
                	num--;
                	totalNum--;
                	totalPrice=parseFloat((totalPrice-price).toFixed(2));
                	for(var i in cart){
	                    if(cart[i].id == id){
	                        cart[i].num=num.toFixed(2);
	                    }
	                }
                }
                
                if(user_id>0){
                	 discountPrice=(totalPrice*(1-discount)).toFixed(2);
                	deal=(totalPrice-discountPrice).toFixed(2);
                }else{
                	discountPrice = 0;
                	deal = totalPrice;
                }
               
                $(this).siblings('.menu-list-num').val(num.toFixed(2));
                $('.totalPrice').html(totalPrice);
                $('.totalNum').html(totalNum.toFixed(2));
                $('.discountPrice').html(discountPrice);
                $('.deal').html(deal);
            });
            $('body').on('click','.custom-menu .icon-add',function () {
                var num=$(this).siblings('.menu-list-num').val();
                var id=$(this).parents('.custom-menu-list').attr('data-id');
                var price=parseFloat($(this).parent().siblings().find('.custom-menu-list-price').html());
                num++;
                totalNum++;
                for(var i in cart){
                    if(cart[i].id == id){
                        cart[i].num=num.toFixed(2);
                    }
                }

                totalPrice=parseFloat((price+totalPrice).toFixed(2));
                if(user_id>0){
                	 discountPrice=(totalPrice*(1-discount)).toFixed(2);
                	deal=(totalPrice-discountPrice).toFixed(2);
                }else{
                	discountPrice = 0;
                	deal = totalPrice;
                }

                $(this).siblings('.menu-list-num').val(num.toFixed(2));
                $('.totalPrice').html(totalPrice);
                $('.totalNum').html(totalNum.toFixed(2));
                $('.discountPrice').html(discountPrice);
                $('.deal').html(deal);
            });
            $('body').on('focusout','.menu-list-num',function () {
                var num=$(this).val();
                var id=$(this).parents('.custom-menu-list').attr('data-id');
                totalPrice=0;
                totalNum=0;
                if(num == 0){
                	for(var i in cart){
                        if(cart[i].id == id){
                            cart.splice(i,1);
                        }
                    }
                    $(this).parents('.custom-menu-list').remove();
                }else{
                	for(var i in cart){
	                    if(cart[i].id == id){
	                        cart[i].num=num;
	                    }
	                }
                }
                
                for(var i in cart){
                    totalNum+=Number(cart[i].num);
                    totalPrice+=Number(cart[i].price)*Number(cart[i].num)
                }

                
                  if(user_id>0){
                      discountPrice=(totalPrice*(1-discount)).toFixed(2);
                      deal=(totalPrice-discountPrice).toFixed(2);
                  }else{
                      discountPrice = 0;
                      deal = (totalPrice).toFixed(2);
                  }

                $('.totalPrice').html((totalPrice).toFixed(2));
                $('.totalNum').html((totalNum).toFixed(2));
                $('.discountPrice').html(discountPrice);
                $('.deal').html(deal);
            });
            //取单
            var url=window.location.href;
			if( url.indexOf("?") !=-1){
				var str=url.split('=');
				var id=str[1];
				$.ajax({
                	type:"GET",
                	data:'',
                	dataType:'json',
                	url:urlHead+'/order/get_bill/'+id,
                	success:function(json){
                		console.log(json)
                		if(json.user){
//              			isVip=true;
                			$('.vip').show().siblings().hide();
                			var user=json.user;
                			user_id=json.user.id;
                			member=json.user;
                			var avatar=user.avatar ? user.avatar : "/assets/avatar.png"
	                        var user_name='';
	                        balance=user.balance;
	                        discount=json.level.discount;
	                         if(user.first_name){
	                         	user_name=user.first_name+' '+user.last_name;
	                         }else{
	                         	user_name=user.nickname;
	                         }
	                       	user_name+='('+json.user.phone+')';
	                        $('.vip').find('img').attr('src',avatar);
	                        $('.vip').find('.customer').html(user_name);
	                        $('.vip').find('.balance').html(user.balance);
	                        $('.vip').find('.discount').html(json.level.discount);	
                		}
                		totalPrice=json.total_fee;
                		totalNum=json.total_number;
                		discountPrice=json.privilege;
                		deal=(json.total_fee-json.privilege).toFixed(2);
                		$('.totalPrice').html(json.total_fee);
		                $('.totalNum').html(json.total_number);
		                $('.discountPrice').html(json.privilege);
		                $('.deal').html((json.total_fee-json.privilege).toFixed(2))
		               
		                var items=json.items;
		                var li=''
		                $.each(items,function(index,item){
		                	item.num=item.qty;
		                	var unit='';
			               for(var i in units){
			                    if(item.unit == units[i].id){
			                        if(SITE_LANG=='chinese'){
                                		 unit='/'+units[i].title;   
                                	}else{
                                		 unit='/'+units[i].en_title;   
                                	}
			                    }
			                }
			                 li+='<li class="custom-menu-list" data-id="'+item.id+'">'
		                    +'<div class="custom-menu-list-name">'+(SITE_LANG=='chinese'?item.p_title:item.p_.en_title)+'('+(SITE_LANG=='chinese'?item.title:item.en_title)+')'+'</div>'
		                    +'<div>'
		                    +    '<span class="money">￡<span class="custom-menu-list-price">'+item.price+unit+'</span></span>'
		                    +   '<div class="pull-right">'
		                    +       '<span class="iconfont icon-jian"></span>'
		                    +       '<input type="text" class="menu-list-num" value="'+item.qty+'">'
		                    +       '<span class="iconfont icon-add"></span>'
		                    +   '</div>'
		                    +'</div>'
		                    +'</li>'
		                })
		                $('.custom-menu ul').append(li);
						cart=items;
                	}
               
                })
			}
        });
//		//线上订单打印
//		var online = new OrderPushClient();
//		online.start();
//		online.on('orderCreated', function (e) {
//		    console.log(e.data.order_id);
//		    var id=e.data.order_id;
//		    $.ajax({
//      		type:'GET',
//      		dataType:'json',
//      		url:urlHead+'/order/get_order/'+id,
//      		success:function(json){
//      			console.log(json)
//
//	                $('#printer').show().siblings().hide();
//	                $('#printer .offline').hide();
//	                $('#printer .online').show();
//	                
//	                var deliveryTime=json.order.shipping_date+' '+json.order.shipping_time;
//      			var paymode = SITE_CONFIG.pay_types[0][SITE_LANG];
//                  if(json.order.money == 0) paymode = '';
//                  if(json.order.pay_mode>0) paymode+= SITE_CONFIG.pay_types[json.order.pay_mode][SITE_LANG];
//                   
//      			$('.print-order .cashier-name').html( CASHIER);
//      			$('.print-order .order-time').html(json.order.create_time);
//      			$('.print-order .order_id').html(json.order.order_id);
//      			$('.print-order .print-order-payMode').html(paymode+'支付');
//      			$('.print-order .delivery-time').html(deliveryTime);
//      			var list=''
//      			var count=0;
//      			$.each(json.items,function(index,item){
//      				count+=Number(item.qty);
//      				list+='<div class="print-table-list">'
//							+'<div class="print-food">'+(index+1)+'.'+item.product.title+'</div>'
//							+'<div class="print-food-detail">'
//							+	'<span>'+item.price+'</span>'
//							+	'<span>'+item.qty+'</span>'
//							+	'<span>'+item.total+'</span>'
//							+'</div>'
//						+'</div>'
//      			})
//      			$('.print-order .print-table-body').html(list);
//      			$('.print-order .print-table-total-food').html(count.toFixed(2));
//      			$('.print-order .print-table-total-price').html(json.order.total);
//      			if(json.user){
//      				var user=json.user;
//      				$('.print-order .vip-name').html(user.username);
//      				$('.print-order .vip-weixin').html(user.wechat);
//      				$('.print-order .vip-address').html((json.order.address.address?json.order.address.address:user.address));
//      				$('.print-order .vip-zip').html(user.zip);
//      				$('.print-order .vip-phone').html(user.phone);
//      			}else{
//      				$('.print-order .vip-name-box').html('联系姓名：');
//      			}
//      			var consumption='';
//      			consumption+='<div class="print-list" >消费金额：'+json.order.total+'</div>'
//							+'<div class="print-list" >优惠金额：'+json.order.cut_fee+'</div>'
//					
//					if(json.order.user_id > 0){
//						consumption+='<div class="print-list" >会员支付：'+json.order.money+'</div>'
//						if(json.order.pay_fee>0){
//							consumption+='<div class="print-list" >'+SITE_CONFIG.pay_types[json.order.pay_mode][SITE_LANG]+'支付：'+json.order.pay_fee+'</div>'
//						}	
//						consumption+='<div class="print-list" >上次余额：'+json.order.last+'</div>'
//									+'<div class="print-list" >当前余额：'+json.order.now+'</div>'
//					}else{
//						consumption+='<div class="print-list" >'+paymode+'支付：'+json.order.pay_fee+'</div>'
//					}
//							
//      			$('.consumption').html(consumption);
//      			
//      			var vatNet=parseFloat(json.order.total)-parseFloat(json.order.cut_fee)-parseFloat(json.order.vat);
//      			var vatGross=parseFloat(json.order.total)-parseFloat(json.order.cut_fee);
//      			$('.print-order .vat-net').html(vatNet.toFixed(2));
//      			$('.print-order .vat-20').html(json.order.vat);
//      			$('.print-order .vat-gross').html(vatGross.toFixed(2));
//      			$('.print-time-detail').html(getTime())
//      			$('#printer').jqprint();
//      		}
//      	})
//		});
		//商品图片大图
        $('body').on('mouseenter','.shop-lists .shop-list .shop-list-img img',function(){
            var img = $(this).attr('src');
            var top = $(this).offset().top;
            var left = $(this).offset().left+100;
            $('img.lg').remove();
            $('body').append('<img src="'+img+'" class="lg" style="left:'+left+'px;top:'+top+'px;position: absolute;width: 300px; height: 300px;border:1px solid #dedede; background-color:#fff"/>')
        })

        $('body').on('mouseleave','.shop-lists .shop-list .shop-list-img img',function(){
            $('img.lg').remove();
        })
    </script>
</body>
</html>